{ ================================================================= }
{                                                                   }
{    PFLOW - PlanFlow Main Program                                  }
{                                                                   }
{    VERSION: PC6.1d                                                }
{    CREATED: 20:38:41  09/30/1985                                  }
{    REVISED: 8/28/93 to allow longer printcodes                    }
{                                                                   }
{ ================================================================= }

{ ------------------------------------------------------------------------ }
{ Copyright 1982 - 1993 James S Stone, dba Project Control Systems         }
{                                                                          }
{ Licensed under the Apache License, Version 2.0 (the "License");          }
{ you may not use this file except in compliance with the License.         }
{ You may obtain a copy of the License at                                  }
{                                                                          }
{ http://www.apache.org/licenses/LICENSE-2.0                               }
{                                                                          }
{ Unless required by applicable law or agreed to in writing, software      }
{ distributed under the License is distributed on an "AS IS" BASIS,        }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and      }
{ limitations under the License.                                           }
{ ------------------------------------------------------------------------ }

{$DEFINE NotShareWare}                  {!!}


{$R-}                                   {Range checking off}
{$B+}                                   {Boolean complete evaluation on}
{$S+}                                   {Stack checking on}
{$I+}                                   {I/O checking on}
{$N-}                                   {No numeric coprocessor}
{$V-}


{ PFlow -  PlanFlow Main Program }
program PFlow;


uses
  Crt,
  Dos,
  Printer,
  PfComm,
  PfEdit,
  PfDisp,
  PfRept,
  PfFile,
  PfCurv;



  { DispSharewareScreen - show shareware info }
  procedure DispSharewareScreen;
  begin
    WriteLn('This is an unregistered copy of PLANFLOW');
    WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'^M^J);

    WriteLn('The copy of PlanFlow that you have is a "shareware" product.  PlanFlow is a');
    WriteLn('copyrighted, proprietary program offered to you for your personal testing and');
    WriteLn('use.'^M^J);

    WriteLn('You are free to use, copy and distribute PlanFlow for NONCOMMERCIAL purposes');
    WriteLn('so long as no fee is charged for use, copying or distribution, and it is not');
    WriteLn('modified in any way.'^M^J);

    WriteLn('If you find that PlanFlow meets your needs, your registering PlanFlow');
    WriteLn('would be appreciated.  The $85 registration includes a diskette and');
    WriteLn('preprinted manual of the current version, as well as discounts for future');
    WriteLn('versions of the software when they become available.  To register, print out a');
    WriteLn('copy of the file ORDER.DOC'^M^J);

    WriteLn('PlanFlow Version 6.1d');
    WriteLn('Copyright 1982-1993 (C) Project Control Systems');
    WriteLn('13000 SW Foothill Drive, Portland, OR  97225-4850');
    WriteLn('503-644-3572     CompuServe: 72677,243');
  end;



  { goodbye  -  leave PlanFlow and return to DOS }
  procedure GoodBye;
  var Check : Integer;
  begin
    Menu[0].Brief := 'No';
    Menu[0].Full := 'Do not quit PlanFlow  --  return to Main menu';
    Menu[1].Brief := 'Yes';
    Menu[1].Full :=
    'Quit PlanFlow and return to DOS.  Have you Saved your project?';
    Check := MenuChoice(1, Ioff);
    if Check = 1 then begin
      ClrScr;
      CursorOff(False);
      {$IFDEF ShareWare}
      TextColor(LightGray);
      DispSharewareScreen;
      {$ENDIF}
      Halt;
    end;
  end;                                  { goodbye }


begin                                   { pfstart }
  CheckBreak := False;
  if Lo(DosVersion) < 2 then begin
    WriteLn('PlanFlow requires DOS 2.0 or higher');
    Halt
  end;
  TextColor(Green);
  TextBackground(Black);
  ClrScr;                               { display screen }
  CursorOff(True);
  {$IFNDEF ShareWare}
    GotoXY(36, 10);
    Write('PlanFlow');
    GotoXY(15, 12);
    Write('Copyright (C) 1982 - 1993 Project Control Systems');
    GotoXY(11, 13);
    Write('13000 SW Foothill Dr., Portland, Oregon 97225  (503) 644-3572');
    GotoXY(31, 14);
    Write('All Rights Reserved');
    GotoXY(33, 16);
    Write('Version PC6.1d');
    GotoXY(30, 20);
    InputColor(Inverse);
    Write('Press <F1> for Help');
    Delay(2000);
  {$ELSE}
  DispSharewareScreen;

  InputColor(Inverse);
  GotoXY(28, 25);
  Write('Press any key to continue');
  C := ReadKey;
  {$ENDIF}

  DisplayIlist(GROUPOFF);
  repeat
    HelpNum := 5;
    if Pbuf.Start = 0 then
      Pbuf.Start := 1;
    Pstatus;
    State(Menus);
    Menu[0].Brief := 'Edit';
    Menu[0].Full := 'Edit Item or Global project information';
    Menu[1].Brief := 'Display';
    Menu[1].Full := 'Display Item or Global project information';
    Menu[2].Brief := 'File';
    Menu[2].Full := 'Retrieve, Merge, Save, Erase, Clear, or DIF files';
    Menu[3].Brief := 'Report';
    Menu[3].Full := 'Print a project report';
    Menu[4].Brief := 'Curve';
    Menu[4].Full := 'Add, Graph, Print, or Erase curves';
    Menu[5].Brief := 'Quit';
    Menu[5].Full := 'Quit PlanFlow and return to DOS';
    Choice := MenuChoice(5, Ion);
    case Choice of
      0 : PfEditMenu;
      1 : PfDispMenu;
      2 : PfFileMenu;
      3 : PfReportMenu;
      4 : PfCurveMenu;
      5 : GoodBye                       { goto DOS }
    end;
  until False = True
end.                                    { PFlow }
